package com.kim.smartring.net.business;

import android.content.Context;

import com.kim.smartring.net.ACommunication;
import com.kim.smartring.net.AEntity;
import com.kim.smartring.net.IReceiverListener;
import com.kim.smartring.net.entity.UpdateDeviceBindingEntity;
import com.kim.smartring.net.impl.PostCommunication;

public class UpdateBindingBusiness {

	public interface UpdateBindingCallback {
		void onUpdateSuccess();

		void onUpdateFail();
	}

	public static void updateBinding(Context context, String uid,
			String deviceId, UpdateBindingCallback bindingCallback) {
		UpdateDeviceBindingEntity entity = new UpdateDeviceBindingEntity(
				context, uid, deviceId, new IReceiverListener() {

					@Override
					public void onReceive(AEntity entity) {
						// TODO Auto-generated method stub

					}
				});

		final ACommunication comm = new PostCommunication(entity);
		new Thread(new Runnable() {

			@Override
			public void run() {
				try {
					comm.sendEntity();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}).start();
	}
}
